﻿using System;
using Domain;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TianYuan.AutoMapper;
using TianYuan.Core.Caching;
using TianYuan.Core.Dependency;
using TianYuan.Core.Reflection;
using TianYuan.Data.Dapper;
using TianYuan.Logging.Log4Net;
using TianYuan.Utils.Logging;
using TianYuan.Web.Api.Dependency;
using TianYuan.Web.Mvc.Dependency;

namespace LocalTest
{
    [TestClass]
    public class UnitTest1
    {
        string url = "";
        [TestInitialize]
        public void init()
        {
            url = "http://localhost:49741";
            Log4NetLoggingInitializer.Initialize(new LoggingConfig(true, LogLevel.All));

            ILogger logger = LogManager.GetLogger(typeof(UnitTest1));
            ICacheProvider provider = new RuntimeMemoryCacheProvider();

            CacheManager.SetProvider(provider, CacheLevel.First);

            MvcBootstrapper mvcBootstrapper = new MvcBootstrapper(new ConventionalRegistrarConfig(false, true));
            ApiBootstrapper apiBootstrapper = new ApiBootstrapper(mvcBootstrapper.IocManager);
            //初始化数据组件
            DapperDataBootsrapper dapperDataBootsrapper = new DapperDataBootsrapper(mvcBootstrapper.IocManager);
            dapperDataBootsrapper.Initialize();

            apiBootstrapper.Initialize();
            //依赖注入初始化
            mvcBootstrapper.Initialize();
            //对象关系映射自动注册
            AutoMapperBootstrapper autoMapperBootstrapper = new AutoMapperBootstrapper(new DirectoryAssemblyFinder());
            autoMapperBootstrapper.Initialize();
            
        }
        [TestMethod]
        public void TestMethod1_AddFieldData()
        {
            

            var service = IocManager.Instance.Resolve<IProductAppService>();
           
        }
    }
}
